﻿using Microsoft.EntityFrameworkCore;
using PlutoStudio.Dependency;
using System;
using System.Collections.Generic;
using System.Text;

namespace PlutoStudio.EF.Configuration
{
    public class EfConfiguration : IEfConfiguration
    {
        private readonly IIocManager _iocManager;

        public EfConfiguration(IIocManager iocManager)
        {
            _iocManager = iocManager;
        }

        public void AddDbContext<TDbContext>(Action<DbContextConfiguration<TDbContext>> action)
            where TDbContext : DbContext
        {
            _iocManager.Register<IDbContextConfigurer<TDbContext>, DbContextConfigurerAction<TDbContext>>(new DbContextConfigurerAction<TDbContext>(action));
        }
    }
}
